<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .container{
            width: 500px;
            height: 500px;
            display: flex;
            justify-content: center;
            align-items: center;
            flex-direction: column;
        }

        .btns{
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .btns button{
            width: 100px;
            height: 50px;
            margin: 0 10px;
            background-color: blue;
        }

        .content{
            width: 300px;
            height: 300px;
            border: 2px solid black;
        }

        .yellow{
            background-color: yellow;
        }

        .blue{
            background-color: blue;
        }

        .red{
            background-color: red;
        }

        .green{
            background-color: green;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="btns">
            <button id="demo1" data-color="yellow">Yellow</button>
            <button id="demo2" data-color="blue">Blue</button>
            <button id="demo3" data-color="red">Red</button>
            <button id="demo4" data-color="green">Green</button>
        </div>
        <div class="content"></div>
    </div>
</body>
</html>

<script>
    document.querySelector('.btns').addEventListener('click', (event) => {
        if (event.target.tagName === 'BUTTON') {
            let color = event.target.getAttribute('data-color');
            let content = document.querySelector('.content');
            content.className = 'content ' + color;
        }
    });
</script>